package com.pig4cloud.pigx.is.utils;

import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;

/**
 * @ClassName TypeUtils
 * @Description: 类型转换工具类
 * @Author wshaha
 * @Date 2020/12/5
 * @Version V1.0
 **/
public class MyTypeUtils {

	/**
	 * @Author wshaha
	 * @Description //将输入流转换成经过Base64编码的字符串
	 * @Date 13:56 2020/12/5
	 * @Param [io] 待处理的输入流
	 * @return java.lang.String
	 **/
	public static String InputStreamToBase64(InputStream io) throws IOException {
		byte[] bytes = IOUtils.toByteArray(io);
		return Base64.getEncoder().encodeToString(bytes);
	}
}
